package com.hssy.wululuaplan.controller;

import com.hssy.wululuaplan.common.Result;
import com.hssy.wululuaplan.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "下载管理")
@RestController
@RequestMapping("/download")
public class DownloadController {
    @Resource
    private StudentService studentService;

    @ApiOperation(value = "下载学生列表详细信息")
    @GetMapping("allStudentDetail")
    public Result<?> downloadStudentDetailList(@RequestParam(value = "mailTo", required = false)String mailTo) {
        studentService.downloadStudentDetailList(mailTo);
        return Result.success();
    }

    @ApiOperation(value = "发送邮件： 下载指定学生的上课记录")
    @GetMapping("emailToStudentClassRecordList")
    public void emailToStudentClassRecordList(@RequestParam(value = "studentId", required = false) Integer studentId) {
        studentService.emailToStudentClassRecordList(studentId);
    }
}
